using System;
using System.Web;

namespace TheBoard.Models
{
    public class OpenIdAuthenticationModule : IHttpModule
    {
        #region IHttpModule Members

        public void Dispose()
        {
        }

        public void Init(HttpApplication context)
        {
            context.AuthorizeRequest += ContextOnAuthorizeRequest;
        }

        #endregion

        private void ContextOnAuthorizeRequest(object sender, EventArgs eventArgs)
        {
            var application = sender as HttpApplication;
            if (application != null)
            {
                OpenIdAuthentication.AuthorizeRequest(application.Context);
            }
        }
    }
}